home *** CD-ROM | disk | FTP | other *** search
/ Multimedia Jumpstart / Multimedia Microsoft Jumpstart Version 1.1a (Microsoft).BIN / develpmt / examples / infobrws / src / test.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-02-05  |  17.3 KB  |  747 lines

  1. #include <windows.h>
  2. #include <windowsx.h>
  3. #include <dos.h>
  4. #include <string.h>
  5. #include <stdlib.h>
  6. #include <bios.h>
  7. #include "promo.h"
  8. #include "test.h"
  9.  
  10. BOOL CheckForMCA(void);
  11. BOOL FindMatch (char *pszPat, char *buf, UINT cbBuf);
  12. /****************************************************************************
  13.  
  14.     FUNCTION   : GetPCSystemMetrics
  15.  
  16.     PARAMETERS : LPPCSYSTEMMETRICS lpPCSysMetrics
  17.  
  18.     PURPOSE    : calls the functions in this module and loads the
  19.          results into a PCSYSTEMMETRICS table
  20.  
  21.     CALLS      : MODULE
  22.            cNumAudio
  23.            cNumMIDI
  24.            dwGetVersion
  25.            dwGetPhysMem
  26.            dwGetVirtMem
  27.            fVgaCapable
  28.            f256Capable
  29.            dwFreeSpace
  30.            GetHPLJ
  31.            nGetCDROM
  32.            wGetMSCDEXVer
  33.            fTT2Installed
  34.  
  35.     RETURNS    : void
  36.  
  37.     MESSAGES   : none
  38.  
  39.     COMMENTS   :
  40.  
  41.     HISTORY    : 11/14/92 - created - denniscr
  42.  
  43. ****************************************************************************/
  44.  
  45. void PASCAL GetPCSystemMetrics(LPPCSYSTEMMETRICS lpPCSysMetrics)
  46. {
  47.   LPINT lpDriveList = NULL;
  48.   int nNumDrives = 0;
  49.   int i;
  50.   UINT uiOldSEM;
  51.  
  52.   if (lpPCSysMetrics)
  53.   {
  54.     uiOldSEM = SetErrorMode(SEM_FAILCRITICALERRORS);
  55.  
  56.     lpPCSysMetrics->wWINVer = LOWORD(dwGetVersion());
  57.     lpPCSysMetrics->wDOSVer = HIWORD(dwGetVersion());
  58.     lpPCSysMetrics->dwMemAvail = dwGetPhysMem() + dwGetVirtMem();
  59.     lpPCSysMetrics->dwPhysicalMem = ExtMemCheck();
  60.     lpPCSysMetrics->dwVirtualMem = dwGetVirtMem();
  61.  
  62.     lpPCSysMetrics->dwWinFlags = GetWinFlags();
  63.  
  64.  
  65.     lpPCSysMetrics->fVGACapable = fVgaCapable();
  66.     lpPCSysMetrics->f256Capable = f256Capable();
  67.  
  68.       //allocate memory for list of available fixed drives
  69.     lpDriveList = (LPINT)GlobalAllocPtr(GHND, sizeof(int));
  70.       //just look at fixed drives
  71.     nNumDrives = EnumerateDrives(ED_FIXED, lpDriveList);
  72.       //calculate each fixed drives free space
  73.     for (i = 0; i < nNumDrives; i++, lpDriveList++)
  74.     {
  75.       //only look at harddrives
  76.       lpPCSysMetrics->dwDiskFree[i] = dwDiskFreeSpace(*lpDriveList);
  77.     }
  78.       //free the list of available fixed drives
  79.     GlobalFreePtr(lpDriveList);
  80.  
  81.     lpPCSysMetrics->fHPLJPresent = GetHPLJ();
  82.     lpPCSysMetrics->nNumCDROM = nGetCDROM();
  83.     lpPCSysMetrics->wNetType = WNetGetCaps(WNNC_NET_TYPE);
  84.     lpPCSysMetrics->cNumAudio = cNumAudio();
  85.     lpPCSysMetrics->cNumMIDI = cNumMIDI();
  86.     lpPCSysMetrics->wMSCDEXVer = (lpPCSysMetrics->nNumCDROM) ? wGetMSCDEXVer() : 0;
  87.  
  88.     lpPCSysMetrics->fTT1Installed = fTTFInstalled(1);
  89.     lpPCSysMetrics->fTT2Installed = fTTFInstalled(2);
  90.  
  91.  
  92.     SetErrorMode(uiOldSEM);
  93.   }
  94.   return;
  95. }
  96.  
  97. /****************************************************************************
  98.  
  99.     FUNCTION   : cNumAudio
  100.  
  101.     PARAMETERS : void
  102.  
  103.     PURPOSE    : retrieves the number of waveform output devices
  104.          present in the system.
  105.  
  106.     CALLS      : WINDOWS
  107.            GetModuleHandle
  108.            waveOutGetNumDevs
  109.  
  110.     RETURNS    : number of wave output devices found
  111.  
  112.     MESSAGES   : none
  113.  
  114.     COMMENTS   : first checks to see if MMSYSTEM is loaded.  So it works
  115.          in 3.0 as well as 3.1
  116.  
  117.     HISTORY    :      - created  - a-daveh
  118.          11/13/92 - modified - denniscr
  119.  
  120. ****************************************************************************/
  121.  
  122. int PASCAL cNumAudio(void)
  123. {
  124.    UINT (FAR *lpfnwaveOutGetNumDevs) (void);
  125.    HINSTANCE hInstWave;
  126.    int         nRet = 0;
  127.    HANDLE    hModule = GetModuleHandle("mmsystem.dll");
  128.  
  129.    if (hModule)
  130.    {
  131.      hInstWave = LoadLibrary("MMSYSTEM.DLL");
  132.      if (hInstWave > HINSTANCE_ERROR)
  133.      {
  134.        (FARPROC) lpfnwaveOutGetNumDevs =
  135.           GetProcAddress(hInstWave, "waveOutGetNumDevs");
  136.        nRet = (*lpfnwaveOutGetNumDevs) ();
  137.        FreeLibrary(hInstWave);
  138.      }
  139.    }
  140.    return (nRet);
  141. }
  142.  
  143. /****************************************************************************
  144.  
  145.     FUNCTION   : cNumMIDI
  146.  
  147.     PARAMETERS : void
  148.  
  149.     PURPOSE    : This function retrieves the number of MIDI output devices
  150.          present in the system.
  151.  
  152.     CALLS      : WINDOWS
  153.            GetModuleHandle
  154.            waveOutGetNumDevs
  155.  
  156.     RETURNS    : number of midi output devices found
  157.  
  158.     MESSAGES   : none
  159.  
  160.     COMMENTS   : first checks to see if MMSYSTEM is loaded.  So it works
  161.          in 3.0 as well as 3.1
  162.  
  163.     HISTORY    :      - created  - a-daveh
  164.          11/13/92 - modified - denniscr
  165.  
  166. ****************************************************************************/
  167.  
  168. int PASCAL cNumMIDI(void)
  169. {
  170.    UINT (FAR *lpfnmidiOutGetNumDevs) (void);
  171.    HINSTANCE hInstMIDI;
  172.    int         nRet = 0;
  173.    HANDLE    hModule = GetModuleHandle("mmsystem.dll");
  174.  
  175.    if (hModule)
  176.    {
  177.      hInstMIDI = LoadLibrary("MMSYSTEM.DLL");
  178.      if (hInstMIDI > HINSTANCE_ERROR)
  179.      {
  180.        (FARPROC) lpfnmidiOutGetNumDevs =
  181.           GetProcAddress(hInstMIDI, "midiOutGetNumDevs");
  182.        nRet = (*lpfnmidiOutGetNumDevs) ();
  183.        FreeLibrary(hInstMIDI);
  184.      }
  185.    }
  186.    return (nRet);
  187.  
  188. }
  189.  
  190. /****************************************************************************
  191.  
  192.     FUNCTION   : dwGetVersion
  193.  
  194.     PARAMETERS : void
  195.  
  196.     PURPOSE    : The GetVersion function retrieves the current version
  197.          numbers of the Windows and MS-DOS operation systems.
  198.  
  199.     CALLS      : WINDOWS
  200.            GetVersion
  201.  
  202.     RETURNS    : major and minor version numbers of Windows and of MS-DOS.
  203.  
  204.     MESSAGES   : none
  205.  
  206.     COMMENTS   :
  207.  
  208.     HISTORY    :      - created  - a-daveh
  209.  
  210. ****************************************************************************/
  211.  
  212. DWORD PASCAL dwGetVersion(void)
  213. {
  214.     return (DWORD) GetVersion();
  215. }
  216.  
  217. /****************************************************************************
  218.  
  219.     FUNCTION   : fVgaCapable
  220.  
  221.     PARAMETERS : void
  222.  
  223.     PURPOSE    : Determines if the system includes at least a VGA
  224.  
  225.     CALLS      : WINDOWS
  226.            GetDC
  227.            GetDeviceCaps
  228.            ReleaseDC
  229.  
  230.     RETURNS    : BOOL  -  TRUE if VGA, FALSE if !VGA
  231.  
  232.     MESSAGES   : none
  233.  
  234.     COMMENTS   :
  235.  
  236.     HISTORY    :      - created  - a-daveh
  237.  
  238. ****************************************************************************/
  239.  
  240.  
  241. BOOL PASCAL fVgaCapable(void)
  242. {
  243.       //get screen device context
  244.     HDC     hdc = GetDC(NULL);
  245.  
  246.       //is screen res. less then 640 x 480?
  247.     if ((GetDeviceCaps(hdc, HORZRES) < 640) ||
  248.     (GetDeviceCaps(hdc, VERTRES) < 480))
  249.     {
  250.     ReleaseDC(NULL, hdc);
  251.       //if yes, then not VGA
  252.     return FALSE;
  253.     }
  254.     else
  255.     {
  256.     ReleaseDC(NULL, hdc);
  257.       //if no, then VGA
  258.     return TRUE;
  259.     }
  260. }
  261.  
  262. /****************************************************************************
  263.  
  264.     FUNCTION   : f256Capable
  265.  
  266.     PARAMETERS : void
  267.  
  268.     PURPOSE    : determines if the screen dc is capable of at least 8bpp
  269.  
  270.     CALLS      : WINDOWS
  271.            GetDC
  272.            GetDeviceCaps
  273.            ReleaseDC
  274.  
  275.     RETURNS    : number of wave output devices found
  276.  
  277.     MESSAGES   : none
  278.  
  279.     COMMENTS   : first checks to see if MMSYSTEM is loaded.  So it works
  280.          in 3.0 as well as 3.1
  281.  
  282.     HISTORY    :      - created  - a-daveh
  283.  
  284. ****************************************************************************/
  285.  
  286.  
  287. BOOL PASCAL f256Capable(void)
  288. {
  289.       //get screen device context
  290.     HDC     hdc = GetDC(NULL);
  291.  
  292.       //is the screen dc capable of at least 8bpp?
  293.     if ((GetDeviceCaps(hdc, NUMCOLORS) >= 256) ||
  294.     (GetDeviceCaps(hdc, BITSPIXEL) >= 8))
  295.     {
  296.     ReleaseDC(NULL, hdc);
  297.       //at least 8bpp
  298.     return TRUE;
  299.     }
  300.     else
  301.     {
  302.     ReleaseDC(NULL, hdc);
  303.       //less than 8bpp
  304.     return FALSE;
  305.     }
  306. }
  307.  
  308. /****************************************************************************
  309.  
  310.     FUNCTION   : dwDiskFreeSpace
  311.  
  312.     PARAMETERS : void
  313.  
  314.     PURPOSE    : calculates the free space on the given drive
  315.  
  316.     CALLS      : WINDOWS
  317.            GetDriveType
  318.          C
  319.            _dos_getdiskfree
  320.  
  321.     RETURNS    : amount of free disk space in KB
  322.  
  323.     MESSAGES   : none
  324.  
  325.     COMMENTS   :
  326.  
  327.     HISTORY    :      - created  - a-daveh
  328.          11/14/92 - modified - denniscr
  329.          12/28/92 - modified to return the total space on the disk
  330.                 should generalize the function but no time!
  331.  
  332. ****************************************************************************/
  333.  
  334.  
  335. DWORD PASCAL dwDiskFreeSpace(int drive)
  336. {
  337.   struct diskfree_t diskspace;
  338.   DWORD            dwFree;
  339.  
  340.       //increment drive by one.  The windows GetDriveType expects
  341.       //A == 0, etc. whereas _dos_getdiskfree expects A == 1!!!
  342.     if (_dos_getdiskfree(drive + 1, &diskspace) != 0)
  343.     return ((DWORD)0);
  344.  
  345. //    dwFree = (DWORD)diskspace.avail_clusters *
  346.     dwFree = (DWORD)diskspace.total_clusters *
  347.          (DWORD)diskspace.sectors_per_cluster *
  348.          (DWORD)diskspace.bytes_per_sector;
  349.  
  350.     dwFree = dwFree / 1024;        /* return value in kilobytes */
  351.  
  352.     return (dwFree);
  353. }
  354.  
  355. /****************************************************************************
  356.  
  357.     FUNCTION   : GetHPLJ
  358.  
  359.     PARAMETERS : void
  360.  
  361.     PURPOSE    : determine if the an HPLJ has been installed.
  362.  
  363.     CALLS      : WINDOWS
  364.             LocalAlloc
  365.             LocalLock
  366.             GetProfileString
  367.             LocalUnlock
  368.  
  369.  
  370.     RETURNS    : int
  371.  
  372.     MESSAGES   : none
  373.  
  374.     COMMENTS   : just checks the WIN.INI folks!
  375.  
  376.     HISTORY    : 11/12/92 - created - denniscr
  377.  
  378. ****************************************************************************/
  379.  
  380. BOOL PASCAL GetHPLJ()
  381. {
  382.   LOCALHANDLE hDeviceMem;
  383.   LPSTR       lpsAllDevices;
  384.   LPSTR          lpsDevice;
  385.  
  386.   hDeviceMem = LocalAlloc(LMEM_MOVEABLE | LMEM_ZEROINIT, MAXALLDEVICELEN);
  387.   lpsAllDevices = (LPSTR)LocalLock(hDeviceMem);
  388.  
  389.   GetProfileString("devices", NULL, "ERROR!", lpsAllDevices,
  390.                            MAXALLDEVICELEN);
  391.   if (*lpsAllDevices)
  392.     for (lpsDevice = lpsAllDevices; *lpsDevice != '\0';
  393.      lpsDevice += lstrlen (lpsDevice)+1)
  394.     {
  395.  
  396.       if ( _fstrstr( _fstrupr(lpsDevice),"LASERJET"))
  397.       {
  398.     LocalUnlock(hDeviceMem);
  399.     LocalFree(hDeviceMem);
  400.     return(TRUE);
  401.       }
  402.  
  403.       //GetProfileString("devices", lpsDevice, "ERROR", szTemp, 255);
  404.       //if ((lpsDriver = _fstrtok( szTemp, ",")))
  405.       //{
  406.       //if ( _fstrstr( _fstrupr(lpsDriver),"HPPCL"))
  407.       //{
  408.       //    LocalUnlock(hDeviceMem);
  409.       //    LocalFree(hDeviceMem);
  410.       //    return(TRUE);
  411.       //}
  412.       //}
  413.     }
  414.  
  415.     //free local memory
  416.   LocalUnlock(hDeviceMem);
  417.   LocalFree(hDeviceMem);
  418.  
  419.     //if we made it here we failed
  420.   return(FALSE);
  421. }
  422.  
  423.  
  424. /****************************************************************************
  425.  
  426.     FUNCTION   : fTTFInstalled
  427.  
  428.     PARAMETERS : void
  429.  
  430.     PURPOSE    : test to see if any of the TT2 fontpack fonts are installed
  431.  
  432.     CALLS      :
  433.  
  434.     RETURNS    : BOOL
  435.  
  436.     MESSAGES   : none
  437.  
  438.     COMMENTS   :
  439.  
  440.     HISTORY    : 11/19/92  - created  - denniscr
  441.  
  442. ****************************************************************************/
  443.  
  444. BOOL PASCAL fTTFInstalled(int nPack)
  445. {
  446.   int i;
  447.   OFSTRUCT of;
  448.   WORD wReturn;
  449.   LPSTR lpSysDir;
  450.  
  451.   lpSysDir = (LPSTR)GlobalAllocPtr(GHND, 256 * sizeof(char));
  452.  
  453.   if (wReturn)
  454.  
  455.   for (i = 0; i < ((nPack == 1) ? NUMTT1FONTS : NUMTT2FONTS); i++)
  456.   {
  457.     wReturn = GetSystemDirectory(lpSysDir, (UINT)GlobalSize(GlobalPtrHandle(lpSysDir)));
  458.  
  459.     if (wReturn)
  460.     {
  461.       lstrcat(lpSysDir, (LPSTR)"\\");
  462.       lstrcat(lpSysDir, ((nPack == 1) ? (LPSTR)TT1List[i].szFN : (LPSTR)TT2List[i].szFN));
  463.     }
  464.     else
  465.       lstrcpy(lpSysDir, ((nPack == 1) ? (LPSTR)TT1List[i].szFN : (LPSTR)TT2List[i].szFN));
  466.  
  467.     if (HFILE_ERROR != OpenFile(lpSysDir, &of, OF_EXIST))
  468.     {
  469.       GlobalFreePtr(lpSysDir);
  470.       return(TRUE);
  471.     }
  472.   }
  473.   GlobalFreePtr(lpSysDir);
  474.   return(FALSE);
  475. }
  476.  
  477. /****************************************************************************
  478.  
  479.     FUNCTION   : BitCount
  480.  
  481.     PARAMETERS :
  482.  
  483.     PURPOSE    :
  484.  
  485.     CALLS      :
  486.  
  487.     RETURNS    : int
  488.  
  489.     MESSAGES   : none
  490.  
  491.     COMMENTS   :
  492.  
  493.     HISTORY    : 12/12/92 - created - denniscr ala KR
  494.  
  495. ****************************************************************************/
  496.  
  497. int BitCount(DWORD dwBitField)
  498. {
  499.    int nCount;
  500.  
  501.    for (nCount = 0; dwBitField != 0; dwBitField >>= 1)
  502.      if (dwBitField & 1)
  503.     nCount++;
  504.  
  505.    return (nCount);
  506. }
  507.  
  508. /****************************************************************************
  509.  
  510.     FUNCTION   : GetDOS_OEM
  511.  
  512.     PARAMETERS :
  513.  
  514.     PURPOSE    :
  515.  
  516.     CALLS      :
  517.  
  518.     RETURNS    : int
  519.  
  520.     MESSAGES   : none
  521.  
  522.     COMMENTS   :
  523.  
  524.     HISTORY    : 1/1/93 - created - denniscr
  525.  
  526. ****************************************************************************/
  527.  
  528. int GetDOS_OEM(WORD wDOSVer)
  529. {
  530.  
  531.   struct _find_t DTABuffer;
  532.   int     nResult = 0;
  533.   char     *env_OS;
  534.   char     szOS[25];
  535.   HFILE  hfReadFile;
  536.   int     nRet = 0;
  537.   int     cbBuf = 1024;
  538.  
  539.   if (HIBYTE(wDOSVer) == 0x0A || HIBYTE(wDOSVer) == 0x14)
  540.     return (OS_OS2);
  541.  
  542.   nResult = _dos_findfirst("C:\\MSDOS.SYS", _A_HIDDEN | _A_SYSTEM, &DTABuffer);
  543.  
  544.     //if MSDOS.SYS is found then this is really MS_DOS
  545.   if (!nResult)
  546.     nRet = OS_MSDOS;
  547.  
  548.   else
  549.   {
  550.     hfReadFile = _lopen("C:\\IBMBIO.COM", READ);
  551.  
  552.     if (hfReadFile != HFILE_ERROR)
  553.     {
  554.       int    cbRead;
  555.       PBYTE  pBuf;
  556.  
  557.       pBuf = (PBYTE) LocalAlloc(LMEM_FIXED | LMEM_ZEROINIT, cbBuf);
  558.  
  559.       cbRead = _lread(hfReadFile, pBuf, cbBuf);
  560.  
  561.       if (cbRead)
  562.       {
  563.     if (FindMatch ("COMPAQ", (char *)pBuf, cbBuf))
  564.       nRet = OS_MSDOS;
  565.     else
  566.       nRet = OS_PCDOS;
  567.       }
  568.  
  569.       LocalFree((HLOCAL) pBuf);
  570.       _lclose(hfReadFile);
  571.     }
  572.  
  573.       //if the dos ver is 3.31 then be suspicious of
  574.       //DRDOS.    Take a look at the environment variables
  575.       //if one of them is OS then see if it is DRDOS.
  576.       //This will work if the user has not changed their
  577.       //environment variables...
  578.       //BTW - DRDOS froze their version number at 3.31
  579.     if (wDOSVer == 0x031F)
  580.     {
  581.       env_OS = getenv( "OS" );
  582.       strcpy(szOS, env_OS);
  583.  
  584.       if (strstr(env_OS, (NPSTR)"DRDOS"))
  585.     nRet = OS_DRDOS;
  586.     }
  587.  
  588.   }
  589.   return( ((nRet) ? nRet : OS_MSDOS) );
  590. }
  591.  
  592.  
  593.  
  594. /****************************************************************************
  595.  
  596.     FUNCTION   : IsWFWCommDlg
  597.  
  598.     PARAMETERS :
  599.  
  600.     PURPOSE    : This function returns non-zero if the machine is an
  601.          MCA machine.
  602.  
  603.  
  604.     CALLS      :
  605.  
  606.     RETURNS    : BOOL : TRUE if this is the COMMDLG from wfw
  607.  
  608.     MESSAGES   : none
  609.  
  610.     COMMENTS   : in addition to checking the net (multinet bit) this may
  611.          be called to determine if this is WFW or not.    A situation
  612.          requiring this might be when wfw has been installed but
  613.          no net drivers
  614.  
  615.          !!!THIS IS INCREDIBLY VERSION DEPENDENT!!!
  616.  
  617.     HISTORY    : 1/22/93 - created - denniscr
  618.          1/28/93 - modified - denniscr
  619.  
  620. ****************************************************************************/
  621.  
  622. BOOL IsWFWCommDlg()
  623. {
  624.     OFSTRUCT of;
  625.     char   szName[MAXPATHLEN];
  626.  
  627.     GetSystemDirectory((LPSTR)szName, (UINT)MAXPATHLEN);
  628.     lstrcat((LPSTR)szName, (LPSTR)"\\WFWSETUP.CPL");
  629.  
  630.     if ( OpenFile((LPSTR)szName, &of, OF_EXIST) != HFILE_ERROR )
  631.       return (TRUE);
  632.     else
  633.       return (FALSE);
  634.  
  635. /*
  636.  
  637.     DWORD  handle;
  638.     DWORD  dwSize = 0;
  639.     BOOL   fRet = FALSE;
  640.     HINSTANCE    hInstVer;
  641.     char   szName[MAXPATHLEN];
  642.     DWORD (FAR *lpfnGetFileVersionInfoSize) (LPCSTR, DWORD FAR*);
  643.  
  644.     //this isn't working for some reason...
  645.     //so...let's make it easy and just look for WFWSETUP.CPL
  646.     //an file that is unique to WFW.
  647.  
  648.     if (lpPCSysMetrics->wWINVer == WIN31VER)
  649.     {
  650.       GetSystemDirectory((LPSTR)szName, (UINT)MAXPATHLEN);
  651.       lstrcat((LPSTR)szName, (LPSTR)"\\COMMDLG.DLL");
  652.  
  653.       hInstVer = LoadLibrary("VER.DLL");
  654.  
  655.       if (hInstVer > HINSTANCE_ERROR)
  656.       {
  657.  
  658.     (FARPROC) lpfnGetFileVersionInfoSize =
  659.           GetProcAddress(hInstVer, "GetFileVersionInfoSize");
  660.  
  661.     dwSize = (*lpfnGetFileVersionInfoSize) ((LPCSTR)szName, (DWORD FAR *)&handle);
  662.  
  663.     if (dwSize)
  664.     {
  665.       LPVS_VERSION    lpstrVffInfo;
  666.       HANDLE    hMem = NULL;
  667.       BOOL    (FAR *lpfnGetFileVersionInfo) (LPCSTR, DWORD, DWORD, void FAR*);
  668.  
  669.       (FARPROC) lpfnGetFileVersionInfo =
  670.           GetProcAddress(hInstVer, "GetFileVersionInfo");
  671.  
  672.         //Get a block big enough to hold version info
  673.       hMem    = GlobalAlloc(GHND, dwSize);
  674.  
  675.       if (hMem)
  676.         lpstrVffInfo = (LPVS_VERSION)GlobalLock(hMem);
  677.  
  678.       if (lpstrVffInfo)
  679.       {
  680.           // Get the info and fill in the pertinent dialog components
  681.         if( (*lpfnGetFileVersionInfo) ((LPCSTR)szName, 0L, dwSize, lpstrVffInfo) )
  682.         {
  683.  
  684.           if ( lpstrVffInfo->vffInfo.dwFileVersionLS == 2 )
  685.         fRet = TRUE;
  686.         }
  687.       }
  688.       else
  689.         GlobalFree(hMem);
  690.  
  691.       if (hMem)
  692.       {
  693.           // free memory
  694.         GlobalUnlock(hMem);
  695.         GlobalFree(hMem);
  696.       }
  697.     }
  698.  
  699.     FreeLibrary(hInstVer);
  700.       }
  701.     }
  702.     return (fRet);
  703. */
  704. }
  705.  
  706.  
  707. /****************************************************************************
  708. *  FindMatch() - Searches a buffer for an asciiz string (case-insensitive)
  709. *
  710. *  Entry
  711. *     pszPat - Asciiz string to search for
  712. *     buf    - Buffer to search through
  713. *     cbBuf  - Length of buffer
  714. *
  715. *  Exit
  716. *     TRUE if match found, FALSE if not.
  717. *
  718. *  Emoryh - 2/2/93
  719. ****************************************************************************/
  720. BOOL FindMatch (char *pszPat, char *buf, UINT cbBuf)
  721. {
  722.    char *psz = pszPat;
  723.    char *p;
  724.  
  725.    for (p=buf; p<&buf[cbBuf]; p++)
  726.    {
  727.  
  728.       if (toupper(*p) == *psz)
  729.      psz++;             // Found match, so advance to next char
  730.       else
  731.          psz = pszPat;              // No match, so reset back to beginning
  732.  
  733.       if (*psz == 0)            // Reached end of pattern - we found it!
  734.      return(TRUE);
  735.    }
  736.  
  737.    // Didn't find pattern
  738.    return(FALSE);
  739. }
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746. 
  747.